# -*- coding:utf-8 -*-


from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.by import By
import time, os

driver = WebDriver(command_executor="http://192.168.0.103:4444",
                   desired_capabilities=DesiredCapabilities.CHROME)

# 打开百度首页并搜索词语，最后判断搜索跳转页面标题是否含有搜索词
wd = 'selenium'
driver.get('https://www.baidu.com')
driver.set_window_size(1440, 797)
driver.find_element(by=By.ID, value="kw").send_keys(wd)
time.sleep(1)
driver.find_element(by=By.ID, value="su").click()
time.sleep(4)
driver.save_screenshot(os.path.join("demoJpg", "page6.png"))
driver.back()
time.sleep(1)
driver.quit()

a = {'acceptInsecureCerts': False, 'browserName': 'chrome', 'browserVersion': '103.0.5060.114', 'chrome': {
    'chromedriverVersion': '103.0.5060.53 (a1711811edd74ff1cf2150f36ffa3b0dae40b17f-refs/branch-heads/5060@{#853})',
    'userDataDir': 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\scoped_dir14032_2066853745'},
     'goog:chromeOptions': {'debuggerAddress': 'localhost:51530'}, 'networkConnectionEnabled': False,
     'pageLoadStrategy': 'normal', 'platformName': 'Windows 10', 'proxy': {}, 'se:bidiEnabled': False,
     'se:cdp': 'ws://192.168.0.103:4444/session/170f285529b62d3d2500c9a5735bf6ff/se/cdp',
     'se:cdpVersion': '103.0.5060.114', 'setWindowRect': True, 'strictFileInteractability': False,
     'timeouts': {'implicit': 0, 'pageLoad': 300000, 'script': 30000}, 'unhandledPromptBehavior': 'dismiss and notify',
     'webauthn:extension:credBlob': True, 'webauthn:extension:largeBlob': True, 'webauthn:virtualAuthenticators': True}

"""
browserName
浏览器名称
The name of the browser being used; 
should be one of {android, chrome, firefox, htmlunit, internet explorer, iPhone, iPad, opera, safari}.

version
浏览器版本
The browser version, or the empty string if unknown.

platform
平台


chromedriverVersion


browserVersion




"""
